version 8.2
capture clear
capture log close
set more off
set mem 1000m
set mat 800




***Insert the appropriate path here
*cd "C:\Users\mchemi\Documents\My Dropbox\judiciary\Cross-country analysis\"
*cd "/Users/matthieuchemin/Dropbox/judiciary/Cross-country analysis/Do files/To upload/"
cd "/Users/chemin/Dropbox/judiciary/Cross-country analysis/Do files/To upload"


do "Preparation World development indicators.do"
*generates "GDP per capita_clean2.dta"
do "Preparation Doing business_Full data.do"
*generates "Doing business_Full data_clean.dta"
do "Preparation Polity IV.do"
*generates "Polity IV.dta"
do "Doing business_quality speed access.do"
*generates "Doing business_p_betaT_l.dta"
*and produces the maps of the word with the suing condition (Figure 2) and the renegotiation condition (Figure 5)


do "Preparation Enterprise Surveys standardized dataset.do"
**works on the standardized dataset
**prepares "Enterprise surveys_clean.dta"
**and prepares "Enterprise surveys_clean2.dta", with one line per country-year
do "Preparation Other reforms.do"
*prepares the other reforms: education, ...
do "Preparation Judicial reforms.do"
*prepares the judicial reforms
do "Preparation Judiciary dependence.do"
*Generates the indicators of Relationship-specific investment with Germany and Sweden
*Generates Figures 3a and 3b
do "Preparation Contract intensive.do"
*Generates the indicators of Relationship-specific investment with Nunn data 
do "Merge Enterprise Surveys standardized dataset_judicial reforms.do"
*merges with judicial reforms



****The next part adds the earlier waves of data not in the standardized dataset to check for common pre-trends
****The files are not standardized, not in a single dataset
****First one has to download all the panel datasets available on the World Bank Enterprise Surveys website:
*do "Append Enterprise surveys panel data.do"
*This do-files appends together all the panel datasets of the World Bank Enterprise Surveys
*It creates "panel_data_clean.dta"
do "Preparation Enterprise surveys earlier waves.do"
*It creates "panel_data_clean2.dta"
**and prepares "panel_data_clean3.dta", with one line per country-year
do "Preparation Judicial reforms_earlier waves.do"
*prepares the judicial reforms
do "Merge Enterprise surveys earlier waves_judicial reforms.do"
*merges with judicial reforms

do "Merge standardized data_earlier waves.do"
*merges standardized dataset and earlier waves of data

do "Analysis.do"
*Creates Table3, 4, 5, E1, H1, C1, G1


do "Table1.do"
*Creates Table1
do "Table C2C3.do"
*Creates Table C2, C3
do "Table D1D2D3.do"
*Creates Table D1, D2, and D3


do "Figures.do"
*Creates Figure B1
do "Judicial_reforms_Map world.do"
*Creates Figure C7 Map of judicial reforms
do "Figure 2 Triple differences.do"
*Creates Figure 2
do "Figure E1E2 Suing condition and Polity.do"
*Creates Figures E1 and E2
